PACKAGE=libtorrent-rb
VERSION := $(shell rpm -q --qf '%{version}\n' --specfile $(PACKAGE).spec | head -1)
RELEASE := $(shell rpm -q --qf '%{release}\n' --specfile $(PACKAGE).spec | head -1)
ARCH := $(shell rpm -q --qf '%{arch}\n' --specfile $(PACKAGE).spec | head -1)
ARCHIVEVER := $(VERSION)

BINDIR      := /usr/bin/
RPM=$(HOME)/rpm
MSGFMT       = /usr/bin/msgfmt


PRODUCT      = "PCLinuxOS 2007"
export PRODUCT

TEXTDOMAIN   = ${PACKAGE}

TARBALL      = libtorrent-$(ARCHIVEVER).tar.gz

LOCALDISTDIR = $(PACKAGE)-$(ARCHIVEVER)

RPMSOURCEDIR = $(shell rpm --eval '%_sourcedir')

SOURCES =\
libtorrent-$(ARCHIVEVER).tar.gz

RPMSOURCES = ${patsubst %,$(RPMSOURCEDIR)/%,${SOURCES}}


bindir=/usr/bin
sbindir=/usr/sbin
datadir=/usr/share
cachedir=/var/cache
localedir=$(datadir)/locale
libdir=/usr/lib
etcdir=/etc

.PHONY: all clean install distclean srccopy rpm rpm-install

srccopy: $(RPMSOURCES)

${RPMSOURCES}: $(RPMSOURCEDIR)/%: %
	cp -f $< $@

rpm: srccopy
	rpmbuild -ba $(PACKAGE).spec
	$(MAKE) clean

rpm-install: rpm
	rpm -Uvh --force `rpm --eval '%_rpmdir'`/$(ARCH)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(ARCH).rpm

upload:
	scp  `rpm --eval '%_rpmdir'`/$(ARCH)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(ARCH).rpm dsmid@oko.clever.cz:www/pclinuxos/2007/RPMS.czech
	scp  `rpm --eval '%_rpmdir'`/$(ARCH)/$(PACKAGE)-devel-$(VERSION)-$(RELEASE).$(ARCH).rpm dsmid@oko.clever.cz:www/pclinuxos/2007/RPMS.czech
	scp  `rpm --eval '%_srcrpmdir'`/$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm dsmid@oko.clever.cz:www/pclinuxos/2007/SRPMS.czech
	ssh dsmid@oko.clever.cz www/pclinuxos/2007/regenerate
